#coding:utf-8
'''
create on 2017-04-20

@author:sandy
'''

from pycommon import Const, BaseCountmanager
import GameDb

class CounterManager(BaseCountmanager.BaseCounterManager):
    
    def __init__(self):
        BaseCountmanager.BaseCounterManager.__init__(self)
        
    def onTimer(self):
        self.doTask()
        
    def doTask(self):
        BaseCountmanager.BaseCounterManager.onTimer(self)
        cmap = self.getCounterMap()
        self.clear()
        for counter, count in cmap.iteritems():
            GameDb.instance.saveCounter(counter, count)
        
    
instance = CounterManager()

if __name__ == '__main__':
    pass